package com.bidevalution.business.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * 表决同意选项
 */
public enum VoteOptionEnum {

    TY(1,"同意"),
    NO_TY(0,"不同意");

    private int code;
    private String name;

    VoteOptionEnum(int code,String name){
        this.code = code;
        this.name = name;
    }

    public static List<String> getNames() {
        List<String> ls = new ArrayList<>();
        VoteOptionEnum[] areas = VoteOptionEnum.values();
        for(VoteOptionEnum item : areas) {
            ls.add(item.getName());
        }
        return ls;
    }

    public String getCodeStr() {
        return code +"";
    }

    public static VoteOptionEnum get(String value) {
        return TY.name.equals(value) || TY.getCodeStr().equals(value) ? TY : NO_TY;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }
}
